/*
 * DiscountSale.cpp
 *  Implementation for the class DiscountSale.
 *  The interface for the class DiscountSale is in the header file DiscountSale.h
 *
 *  Created on: Mar 1, 2014
 *      Author: Anthony Varghese - This is from the Savitch book
 */

#include "DiscountSale.h"

namespace SavitchSale {

DiscountSale::DiscountSale() :
		Sale(), discount(0) {
	//Intentionally empty
}

DiscountSale::DiscountSale(double thePrice, double theDiscount) :
		Sale(thePrice), discount(theDiscount) {
	//Intentionally empty
}

double DiscountSale::getDiscount() const {
	return discount;
}

void DiscountSale::setDiscount(double newDiscount) {
	discount = newDiscount;
}

double DiscountSale::bill() const {
	double fraction = discount / 100;
	return (1 - fraction) * getPrice();
}

} /* namespace SavitchSale */
